<?php

declare(strict_types=1);

namespace App\Services;

class TestService
{
    public function router(string $method, mixed $params = null): mixed
    {
        return match ($method) {
            'test' => $this->test($params),
            default => throw new \Exception(__CLASS__.'类方法不存在'),
        };
    }

    public function test(mixed $params = null): mixed
    {
        return [
            'file' => __FILE__,
            'class' => __CLASS__,
            'method' => __METHOD__,
            'params' => $params,
        ];
    }
}
